import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            in.nextLine();
            String s1 = " " + in.nextLine();
            String s2 = " shy";
            int[][] dp = new int[s1.length()][s2.length()];
            for (int i = 0; i <= n; i++) {
                dp[i][0] = 1;
            }
            for (int j = 1; j < s2.length(); j++) {
                dp[0][j] = 1;
            }
            int ret = 0;
            for (int i = 1; i < s1.length(); i++) {
                for (int j = 1; j < s2.length(); j++) {
                    if (s1.charAt(i) == s2.charAt(j)) {
                        dp[i][j] = dp[i-1][j-1] + 1;
                    } else {
                        dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);
                    }
                    if (dp[i][j] == 4) {
                        ret++;
                    }
                }
            }
            System.out.println(ret);
        }
    }
}
